package conappfig

import (
	"github.com/spf13/viper"
	"log"
)

type Config struct {
	Mysql
	Redis
	Auther
	Upload
}
type Upload struct {
	AccessKey string
	SecretKey string
}
type Auther struct {
	SecretId  string
	SecretKey string
}
type Mysql struct {
	User     string
	Host     string
	Port     int
	Password string
	DataBase string
}
type Redis struct {
	Host     string
	Port     int
	Password string
}

var ConappfigData Config

func Init() {
	viper.SetConfigFile("../shop/conappfig/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&ConappfigData)
	log.Println("Viper 动态配置成功", ConappfigData)
}
